package com.itrident.store;

import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
 * @author cxx
 * @create 2021-04-20 14:53
 **/
@State(name = "PropManagerPersistentState",storages = @Storage("propManager.xml"))
public class PropManagerPersistentState implements PersistentStateComponent<PropManger> {

    private PropManger propManger = new PropManger();

    public static PropManagerPersistentState getInstance(Project project){
        return ServiceManager.getService (project,PropManagerPersistentState.class);
    }

    @Override
    public @Nullable PropManger getState() {
        return propManger;
    }

    @Override
    public void loadState(@NotNull PropManger propManger) {
        this.propManger = propManger;
    }
}
